/**
 * 科目配置常量
 * 统一管理所有科目的信息，便于维护和扩展
 */

// 科目配置映射表
const SUBJECT_CONFIG = {
  english: {
    key: 'english',
    name: '英语',
    title: '深圳1年级英语练习',
    icon: '🇬🇧',
    desc: '字母、单词、拼写练习',
    color: {
      primary: '#4A90E2',
      secondary: '#38ef7d',
      gradient: 'linear-gradient(135deg, #4A90E2 0%, #38ef7d 100%)'
    }
  },
  chinese: {
    key: 'chinese',
    name: '语文',
    title: '深圳1年级语文练习',
    icon: '🇨🇳',
    desc: '拼音学习、笔画书写',
    color: {
      primary: '#FF6B6B',
      secondary: '#FFE66D',
      gradient: 'linear-gradient(135deg, #FF6B6B 0%, #FFE66D 100%)'
    }
  },
  math: {
    key: 'math',
    name: '数学',
    title: '深圳1-3年级数学练习',
    icon: '🔢',
    desc: '1-3年级数学练习',
    color: {
      primary: '#9B59B6',
      secondary: '#3498DB',
      gradient: 'linear-gradient(135deg, #9B59B6 0%, #3498DB 100%)'
    }
  }
};

// 默认科目
const DEFAULT_SUBJECT = 'english';

// 获取科目信息
function getSubjectInfo(subjectKey) {
  return SUBJECT_CONFIG[subjectKey] || SUBJECT_CONFIG[DEFAULT_SUBJECT];
}

// 获取所有科目列表
function getAllSubjects() {
  return Object.values(SUBJECT_CONFIG);
}

// 获取科目名称
function getSubjectName(subjectKey) {
  const subject = getSubjectInfo(subjectKey);
  return subject ? subject.name : SUBJECT_CONFIG[DEFAULT_SUBJECT].name;
}

// 获取科目标题
function getSubjectTitle(subjectKey) {
  const subject = getSubjectInfo(subjectKey);
  return subject ? subject.title : SUBJECT_CONFIG[DEFAULT_SUBJECT].title;
}

module.exports = {
  SUBJECT_CONFIG,
  DEFAULT_SUBJECT,
  getSubjectInfo,
  getAllSubjects,
  getSubjectName,
  getSubjectTitle
};

